/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tni;


import java.util.ArrayList;

/**
 *
 * @author jgres
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    
   
    public static void main(String[] args) {

        // On creer l'ensemble des elements
        Element x1 = new Element(0.35);
        Element x2 = new Element(0.3);
        Element x3 = new Element(0.2);
        Element x4 = new Element(0.1);
        Element x5 = new Element(0.04);
        Element x6 = new Element(0.005);
        Element x7 = new Element(0.005);
        ArrayList<Element> Liste = new ArrayList();
        Liste.add(x1);
        Liste.add(x2);
        Liste.add(x3);
        Liste.add(x4);
        Liste.add(x5);
        Liste.add(x6);
        Liste.add(x7);

       /* Huffman h = new Huffman(Liste);
        h.ExecuteCodage();
        h.ExecuteCalcul();
        h.ExecuteAffich(false);
        */

        // TP1 + TP2
        Data dataT = new Data("exemple1.txt");
        dataT.constructText();
        /** Fichier image **/
        Data dataI = new Data("lena_gray.gif");
        dataI.constructImage();

        //Get occurence, proba & entropy
       Util util = new Util(dataT,dataI);

       util.foundOccurText();
       util.foundOccurImage();
       util.affTextEntropy();
       
        Huffman h = new Huffman(util.getAlphabet(),dataT.size());
        h.ExecuteCodage();
        h.ExecuteCalcul();
        h.ExecuteAffich(false);

        util.affImageEntropy();
        Huffman h2 = new Huffman(util.getPixel(),dataI.size(),0);
        h2.ExecuteCodage();
        h2.ExecuteCalcul();
        h2.ExecuteAffich(false);   

    }
}
